package com.yang.common.utils;

import com.yang.model.user.pojos.AppUser;

/**
 * @author: Billyang
 * @date: 2024/10/5 22:11
 */
public class AppThreadLocalUtil {
    private final static ThreadLocal<AppUser> WM_USER_THREAD_LOCAL = new ThreadLocal<>();

    //存入线程中
    public static void setUser(AppUser apUser){
        WM_USER_THREAD_LOCAL.set(apUser);
    }

    //从线程中获取
    public static AppUser getUser(){
        return WM_USER_THREAD_LOCAL.get();
    }

    //清理
    public static void clear(){
        WM_USER_THREAD_LOCAL.remove();
    }
}
